<?xml version="1.0" encoding="utf-8"?>
<html xmlns:str="http://exslt.org/strings"><head><title>duetopia - Documentation - OpenSearch Client</title><link rel="stylesheet" href="docs.css"/></head><body><div class="menu"><h3>Setup</h3><p><a href="installation.html">Installation</a><br/><a href="configuration.html">Configuration</a></p><h4>Customisation</h4><p><a href="custom_classes.html">Custom Classes</a></p><h3>Interfaces</h3><p><a href="api.html">Quick API Guide</a><br/><a href="opensearch.html">Opensearch Guide</a><br/><a href="opensearch_client.html">Opensearch Client</a></p></div><div id="header">
<h1>duetopia</h1>
</div><div id="content">
<h2>OpenSearch Client Documentation</h2>

<p>A simple OpenSearch Client is provided with the distribution. It supports <a href="http://www.opensearch.org/Specifications/OpenSearch/Extensions/Geo/1.0/Draft_1">OpenSearch Geo</a> extensions in queries.

<pre>
  <b>from duetopia.opensearch.client import Description

  d = Description("http://127.0.0.1:8000/duetopia/register/dataset/description/")

  print d.types()</b> 

  # print a list of response types that the server will offer
  # <i> ['application/xhtml+xml', 'application/json', 'application/vnd.google-earth.kml+xml']</i>
 
  <b>request = d.request("application/json")</b>     
  # create a request for json output

  <b>print request</b>
  # a list of the search keys - initially empty.            
  # <i>{'geometry': None, 'start': None, 'end': None, 'keyword': None, 'title': None}</i>
  <b>request['geometry'] = "-90, -180, 0, -180, 90, -180, 90, 180, 0, 180, -90, 180, -90, -180"</b>
  
  <b>request.info('geometry')</b>
  # more information about the opensearch response type
  # <i>{geo:polygon}</i> 

  <b>request['title'] = 'bridge'</b>

  # adding another parameter to the request 
            
  <b>print request.response()</b>      
  # get the response from the server in the specified format.
       
</pre>
</p>
<p>
<ul>
<li><a href="http://www.opensearch.org/Specifications/OpenSearch/Extensions/Geo/1.0/Draft_1#The_.22polygon.22_parameter">OpenSearch Geo polygon</a></li>
<li><a href="opensearch.html">Duetopia OpenSearch interface</a></li>
<li><tt>svn/trunk/duetopia/opensearch/client.py</tt></li>
</ul>
</p>

<div id="footer"><p><a href="introduction.html">Introduction / Index</a> | <a href="http://duetopia.googlecode.com/">Code Repository</a></p><p><a href="http://www.terradue.com/duetopia/"><img src="img/terradue_logo.jpg" border="0"/></a></p></div></div></body></html>
